<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 计算一个数的阶乘位数多少个零 -->
    <script>
      var factorial = function (num) {
        let count = 0 // 因为可能出现一个数的质因子有多个5
        while (num >= 5) {
          //返回最大的整数
          num = Math.floor(num / 5)
          count += num
        }
        return count
      }
      // console.log(factorial(3))
      console.log(factorial(5))
    </script>
  </body>
</html>
